/*
 * main.c
 *
 *  Created on: 02/09/2013
 *      Author: steiner
 */

/* Bibliotecas Padrão */
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

/* Bibliotecas Auxiliares */
#include "../CondInis/WaterBag.h"
#include "../Energias/Energia_Cinetica.h"
#include "../Energias/Energia_Potencial_HMF.h"



int main(int argc, char **argv)
{

	int i, op;
	long n = 1000;
	long seed;
	double  *p, *pos, *mass, *vel, *forca;
	double k0, u0, e0;
	double vel_0, pos_0;
	double mx, my;

	FILE *ph0 = fopen("./Output/InitialPhase.dat", "w");

	p  	 = (double *)malloc(n * sizeof(double));
	pos	 = (double *)malloc(n * sizeof(double));
	mass = (double *)malloc(n * sizeof(double));
	vel  = (double *)malloc(n * sizeof(double));
	p    = (double *)malloc(n * sizeof(double));
	forca = (double *)malloc(n * sizeof(double));

	/* Condicao Inicial */

	vel_0 = 2.0;
	pos_0 = 2.0;
	e0 = 0.0;
	seed = 10;

	op = 1;
	WaterBag(op, n, seed, vel_0, pos_0, pos, p, mass, vel);

	for (i = 0; i < n; ++i) {
		fprintf(ph0,"%lf %lf\n", pos[i], p[i]);
		printf("%lf %lf\n", pos[i], p[i]);
	}
	fclose(ph0);

	/* Energia Cinetica Inicial */

	Energia_Cinetica(n, p, &k0);
	EnergiaPotencial_HMF(n, &mx, &my, &u0, mass);

	printf("Energia Cinetica por particula Inicial: %lf \n", k0);
	printf("Energia Potencial por particula Inicial: %lf \n", u0);

	e0 = u0+k0;
	printf("Energia Total por particula Inicial: %lf \n", e0);
	return 0;
}

